<template>
  <div class="mobile-product-4">
    <div v-slide-plus class="banner_title_en">
      <img src="@/assets/min_logo.png" />
      <span>RECOMMENDED PRODUCTS & SERVICES</span>
    </div>
    <Title
      v-slide-up
      title="推荐产品服务"
      left="0"
      color="#0e0b31"
      size="30"
      bold="700"
      align="center"
      :line-height="60"
    />
    <div class="g-box">
      <div
        v-slide-plus
        v-for="(item, index) in dataList"
        :key="index"
        class="g-item"
        @click="handleDetail(item)"
      >
        <img v-slide-plus :src="publicSrc(item.image)" />
        <div class="g-item-bottom">
          <Title
            v-slide-up
            :title="item.name"
            left="0"
            color="#0e0b31"
            size="16"
            bold="700"
            line="1"
            :line-height="24"
          />
          <div v-slide-up class="f f-ac f-je">查看详情</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { serviceList } from "@/api/product";
import { publicSrc } from "@/utils/common";
const router = useRouter();

const queryParams = reactive({
  pageNum: 1,
  pageSize: 3,
  status: 0, // 0显示 1隐藏
  top: 1, // 0不推荐 1推荐
});
const dataList = ref<any>([]); // 推荐产品服务列表

onMounted(() => {
  getList();
});

// 获取推荐产品服务列表
const getList = () => {
  serviceList(queryParams).then((res: any) => {
    if (res.code == 200) {
      dataList.value = res.rows;
    }
  });
};

// 查看详情
const handleDetail = (item: any) => {
  router.push({
    path: "/m/product",
    query: {
      id: item.id,
    },
  });
};
</script>
<style lang="scss" scoped>
.mobile-product-4 {
  width: 100%;
  background: linear-gradient(180deg, #ebebeb 0%, #fff 50%, #ebebeb 100%);
  padding: 3.75rem 1.25rem;
  box-sizing: border-box;
  .banner_title_en {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2.5rem;
    border-radius: 2.5rem;
    background: linear-gradient(90deg, #43cf7c 0%, #26ffc9 100%);
    font-size: 0.875rem;
    font-weight: 700;
    color: #ffffff;
    img {
      width: 2.1875rem;
      height: 1.5rem;
      object-fit: cover;
      margin-right: 0.5rem;
    }
  }
  .g-box {
    width: 100%;
    .g-item {
      height: 23.4375rem;
      background-color: #fff;
      backdrop-filter: blur(1.75rem);
      margin-top: 1.25rem;
      img {
        width: 100%;
        height: 18.1875rem;
        background: #c4c4c4;
        object-fit: cover;
      }
      &-bottom {
        width: 100%;
        height: 5.25rem;
        background-color: #fff;
        padding: 1.125rem 1.75rem;
        box-sizing: border-box;
        color: #409eff;
      }
    }
  }
}
</style>
